<style type="text/css">
.content input {
	width: 100px;
	display: inline;
}
.content .add_pattern {
	margin-left: 15px;
}
.content .control-label {
	margin-right: 10px;
}
</style>
<div class="pageheader">
	<h2>
		<i class="fa fa-inbox"></i>库存管理
	</h2>
	<div class="breadcrumb-wrapper">
		<span class="label">你所在的位置：</span>
		<ol class="breadcrumb">
			<li><a href="/index">ERP管理系统</a></li>
			<li>库存管理</li>
			<li>库存列表</li>
			<li class="active">特殊问题出入库</li>
		</ol>
	</div>
</div>
<div class="contentpanel">
<div class="main">
<form action="/stock/specialmanage?id=<?php echo $this->stocklist['stock_id'];?>" method="post" class="form-horizontal">
    <?php if ($this->msg):?>
    <div style="margin: 20px 216px;" class="form-group"><?php foreach ($this->msg as $v):?><span class="label label-warning"><?php echo $v;?></span><?php endforeach;?></div>
    <?php endif;?> 
    <div class="form-group form-inline">
        <label for="productname" class="col-sm-2 control-label">产品名称：</label>
        <div class="col-sm-10">
            <input type="hidden" class="form-control" name="stockid" value="<?php echo $this->stocklist['stock_id'];?>" size="58">
            <input type="text" readonly="readonly" class="form-control" name="productname" value="<?php echo $this->stocklist['title'];?>" size="58">
        </div>
    </div>
    <div class="form-group form-inline">
        <label for="Sku" class="col-sm-2 control-label">Sku：</label>
        <div class="col-sm-10">
            <input type="text" readonly="readonly" class="form-control" name="sku" value="<?php echo $this->stocklist['sku'];?>" size="58"></input>
        </div>
    </div>
    <div class="form-group form-inline">
        <label for="Orderid" class="col-sm-2 control-label">订单号：</label>
        <div class="col-sm-10">
            <input type="text" class="form-control" name="orderid" value="" size="58"></input>
        </div>
    </div>
    <div class="form-group form-inline">
        <label for="Dutyuser" class="col-sm-2 control-label">责任人：</label>
        <div class="col-sm-10">
            <input type="text" class="form-control" name="dutyuser" value="" size="58"></input>
        </div>
    </div>
    <div class="form-group content">
        <label for="content" class="col-sm-2 control-label">产品内容：</label>
        <div style="margin-bottom: 10px;margin-top:10px">
            <input type="button" class="form-control add_pattern hidden" value="添加规格" onclick="addPatternSize(this);"></input>
            <span class="label label-success">说明：出库库存填负数(如：-1)，入库库存填正数(如：+1)，没操作不填写</span>
		</div>
		<?php foreach($this->stockvaluelist as $v):?>
		<div style="margin-bottom: 10px;margin-left: 200px;">
		        规格大小：
		    <input readonly="readonly" type="text" class="form-control" name="pattern_size[]" value="<?php echo $v['size'];?>" size="15" />
			目前库存：
			<input readonly="readonly" type="text" class="form-control" name="pattern_size_stock[]" value="<?php echo $v['value'];?>" size="10" />
			变化库存：
			<input type="text" class="form-control" name="pattern_size_change[]" value="0" size="10" />
			<input type="button" class="form-control hidden" onclick="deletePatternSize(this);" value="删除">
		</div>
		<?php endforeach;?>   
    </div>
    <div class="form-group">
        <label for="Remark" class="col-sm-2 control-label">事件原因：</label>
        <div class="col-sm-10">
            <textarea class="form-control" name="remark" style="width: 520px;height: 158px;"></textarea>
        </div>
    </div>
    <div class="form-group">
        <div class="col-sm-offset-2 col-sm-10">
            <button type="submit" class="btn btn-default">提交</button>
        </div>
    </div>
</form>
</div>
</div>

<script>
$("form").submit( function () {
	if($("input[name='dutyuser']").val()==''){
		alert("请填写责任人");
		return false;
	}
	if($("textarea[name='remark']").val()==''){
		alert("请填写事件原因");
		return false;
	}
} );
function deletePatternSize(thisInput){
	$(thisInput).parent().remove();
}
function addPatternSize(thisInput){
	$(thisInput).parent().parent().append('<div style="margin-bottom: 10px;margin-left: 230px;">规格大小：&nbsp;<input style="width: 100px;display: inline;" type="text" class="form-control" name="pattern_size[]" value="" size="15"/>&nbsp;目前库存：&nbsp;<input style="width: 100px;display: inline;" type="text" class="form-control" name="pattern_size_stock[]" value="" size="10"/>&nbsp;&nbsp;变化库存：<input type="text" class="form-control" name="pattern_size_change[]" value="" size="10" />&nbsp;<input style="width: 100px;display: inline;" class="form-control" type="button" onclick="deletePatternSize(this);" value="删除"></div>');
	//commonEffection.resetFrame('admins_frame',true);
}
</script>